//
//  CZMeNickNameEditVC.m
//  CZWeiXin
//
//  Created by Alvechen on 16/4/13.
//  Copyright © 2016年 alvechen. All rights reserved.
//

#import "CZMeNickNameEditVC.h"

@interface CZMeNickNameEditVC ()

@property (weak, nonatomic) IBOutlet UITextField *nickNameTF;

///我的资料卡
@property (nonatomic,strong) XMPPvCardTemp  *myvCardTemp;

@end

@implementation CZMeNickNameEditVC

- (XMPPvCardTemp *)myvCardTemp{
    
    return [CZXMPPManager shareInstance].xmppvCardTempModule.myvCardTemp;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    //设置个人资料模块代理
    [[CZXMPPManager shareInstance].xmppvCardTempModule addDelegate:self delegateQueue:dispatch_get_main_queue()];
    
    //显示原来的数据
    self.nickNameTF.text = [CZXMPPManager shareInstance].xmppvCardTempModule.myvCardTemp.nickname;
    
}


/**
 * 确定更新
 */
- (IBAction)doneClick:(id)sender {
    
    //更新数据
    self.myvCardTemp.nickname = self.nickNameTF.text;
    
    //更新同步数据
    
    [[CZXMPPManager shareInstance].xmppvCardTempModule updateMyvCardTemp:self.myvCardTemp];
    
    
}


#pragma mark - XMPPvCardTempModuleDelegate

/**
 * 更新我的资料卡成功
 */
- (void)xmppvCardTempModuleDidUpdateMyvCard:(XMPPvCardTempModule *)vCardTempModule{
    
    [self.navigationController popViewControllerAnimated:YES];
}



@end
